package org.example.Join;

import com.alibaba.druid.pool.DruidDataSourceFactory;

import javax.sql.DataSource;
import java.io.FileInputStream;
import java.sql.Connection;
import java.util.Properties;

public class JDBC_Join {

    public JDBC_Join() {
    }

    //此类，用于数据库的连接
    public Connection join() throws Exception {
        //加载配置文件
        Properties prop = new Properties();
        prop.load(new FileInputStream("D:\\JavaCode\\JDBC_Demo1\\jdbcDemo\\druid.properties"));
        //获取数据库连接
        DataSource dataSource = DruidDataSourceFactory.createDataSource(prop);
        Connection conn = dataSource.getConnection();

        return conn;

    }
}
